<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#222" media="(prefers-color-scheme: dark)">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css" integrity="sha256-mUZM63G8m73Mcidfrv5E+Y61y7a12O5mW4ezU3bxqW4=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"whu_zhangxin.gitee.io","root":"/","images":"/images","scheme":"Gemini","darkmode":true,"version":"8.8.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"}}</script><script src="/js/config.js"></script>
<meta name="description" content="Docker 是一个开源的应用容器引擎，让开发者可以打包他们的应用以及依赖包到一个可移植的镜像中，然后发布到任何流行的 Linux或Windows操作系统的机器上，也可以实现虚拟化。本节内容主要介绍Docker的基础知识和Docker的安装。">
<meta property="og:type" content="article">
<meta property="og:title" content="Docker 简介">
<meta property="og:url" content="http://whu_zhangxin.gitee.io/2021/11/21/docker-intr-01-md/index.html">
<meta property="og:site_name" content="我长不高了">
<meta property="og:description" content="Docker 是一个开源的应用容器引擎，让开发者可以打包他们的应用以及依赖包到一个可移植的镜像中，然后发布到任何流行的 Linux或Windows操作系统的机器上，也可以实现虚拟化。本节内容主要介绍Docker的基础知识和Docker的安装。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://whu_zhangxin.gitee.io/.io//pic01.png">
<meta property="og:image" content="http://whu_zhangxin.gitee.io/.io//blog/source_posts/docker-intr-01-md/pic02.png">
<meta property="og:image" content="http://whu_zhangxin.gitee.io/.io//blog/source_posts/docker-intr-01-md/pic03.png">
<meta property="article:published_time" content="2021-11-21T08:27:24.000Z">
<meta property="article:modified_time" content="2021-11-22T13:52:23.358Z">
<meta property="article:author" content="zhangxin">
<meta property="article:tag" content="docker">
<meta property="article:tag" content="容器">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://whu_zhangxin.gitee.io/.io//pic01.png">


<link rel="canonical" href="http://whu_zhangxin.gitee.io/2021/11/21/docker-intr-01-md/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://whu_zhangxin.gitee.io/2021/11/21/docker-intr-01-md/","path":"2021/11/21/docker-intr-01-md/","title":"Docker 简介"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>Docker 简介 | 我长不高了</title>
  




  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">我长不高了</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">1</span></a></li>
        <li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">2</span></a></li>
        <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">1</span></a></li>
        <li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a></li>
  </ul>
</nav>




</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#Docker-%E5%87%BA%E7%8E%B0%E7%9A%84%E5%8E%9F%E5%9B%A0"><span class="nav-number">1.</span> <span class="nav-text">Docker 出现的原因</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Docker-%E7%9A%84%E5%8F%91%E5%B1%95%E5%8E%86%E7%A8%8B"><span class="nav-number">2.</span> <span class="nav-text">Docker 的发展历程</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#docker%E5%92%8C%E8%99%9A%E6%8B%9F%E6%9C%BA%E7%9A%84%E5%AF%B9%E6%AF%94"><span class="nav-number">2.1.</span> <span class="nav-text">docker和虚拟机的对比</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E8%81%8A%E8%81%8Adocker"><span class="nav-number">3.</span> <span class="nav-text">聊聊docker</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Docker%E8%83%BD%E5%A4%9F%E7%94%A8%E6%9D%A5%E5%B9%B2%E4%BB%80%E4%B9%88"><span class="nav-number">4.</span> <span class="nav-text">Docker能够用来干什么</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#DevOps"><span class="nav-number">4.1.</span> <span class="nav-text">DevOps</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%AE%B9%E5%99%A8%E7%9A%84%E5%AE%89%E8%A3%85"><span class="nav-number">5.</span> <span class="nav-text">容器的安装</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%B9%E5%99%A8%E7%9A%84%E7%BB%84%E6%88%90"><span class="nav-number">5.1.</span> <span class="nav-text">容器的组成</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%9C%A8%E8%85%BE%E8%AE%AF%E4%BA%91%E4%B8%8A%E5%AE%89%E8%A3%85%E5%AE%B9%E5%99%A8"><span class="nav-number">5.2.</span> <span class="nav-text">在腾讯云上安装容器</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="zhangxin"
      src="/images/author.jpg">
  <p class="site-author-name" itemprop="name">zhangxin</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">1</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">1</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">2</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="cc-license site-overview-item animated" itemprop="license">
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" rel="noopener" target="_blank"><img src="https://cdn.jsdelivr.net/npm/@creativecommons/vocabulary@2020.11.3/assets/license_badges/small/by_nc_sa.svg" alt="Creative Commons"></a>
  </div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://whu_zhangxin.gitee.io/2021/11/21/docker-intr-01-md/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/author.jpg">
      <meta itemprop="name" content="zhangxin">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="我长不高了">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Docker 简介
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-11-21 16:27:24" itemprop="dateCreated datePublished" datetime="2021-11-21T16:27:24+08:00">2021-11-21</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-11-22 21:52:23" itemprop="dateModified" datetime="2021-11-22T21:52:23+08:00">2021-11-22</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E4%B8%AD%E9%97%B4%E4%BB%B6/" itemprop="url" rel="index"><span itemprop="name">中间件</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <blockquote>
<p>Docker 是一个<a target="_blank" rel="noopener" href="https://baike.baidu.com/item/%E5%BC%80%E6%BA%90/20720669">开源</a>的应用容器引擎，让开发者可以打包他们的应用以及依赖包到一个可移植的<a target="_blank" rel="noopener" href="https://baike.baidu.com/item/%E9%95%9C%E5%83%8F/1574">镜像</a>中，然后发布到任何流行的 Linux或Windows操作系统的机器上，也可以实现虚拟化。本节内容主要介绍Docker的基础知识和Docker的安装。</p>
</blockquote>
<span id="more"></span>



<h1 id="Docker-出现的原因"><a href="#Docker-出现的原因" class="headerlink" title="Docker 出现的原因"></a>Docker 出现的原因</h1><ul>
<li>在打包时可以将开发环境和jar包一起包装成一个镜像，放到docker仓库中，要安装时可以从仓库中直接拉取，因为拉下来部署是连环境一起拉的，所以不会出现在开发环境可用，但到了生产环境不可用的情况。</li>
<li>docker核心思想是隔离，每个应用单独包装，类似一个箱子，这样可以增加空间的使用率，同时不用一个服务器上有多个应用时存在端口冲突等问题。</li>
</ul>
<h1 id="Docker-的发展历程"><a href="#Docker-的发展历程" class="headerlink" title="Docker 的发展历程"></a>Docker 的发展历程</h1><ul>
<li><p>2010年成立dotCloud: 其目的主要是用来做云化服务</p>
</li>
<li><p>2013年 docker开源，越来越多的人发现了docker的优点</p>
</li>
<li><p>2014年4月 docker1.0 正式发布  </p>
</li>
</ul>
<h2 id="docker和虚拟机的对比"><a href="#docker和虚拟机的对比" class="headerlink" title="docker和虚拟机的对比"></a>docker和虚拟机的对比</h2><ul>
<li><p>虚拟机：安装一个运行虚拟机的软件–&gt;在虚拟机的软件上面运行操作系统的镜像（一台或者多台）====》显得很笨重  </p>
</li>
<li><p>docker和虚拟机一样，都是虚拟化技术，但是docker的镜像是可以非常小的（最核心的环境 4m + 其他需要安装的应用） ==》 显得很小巧，而且docker还可以将不同的应用隔离开开。</p>
</li>
</ul>
<h1 id="聊聊docker"><a href="#聊聊docker" class="headerlink" title="聊聊docker"></a>聊聊docker</h1><p>1）docker是基于go语言开发</p>
<p>2）官网：<a target="_blank" rel="noopener" href="https://www.docker.com/">Empowering App Development for Developers | Docker</a></p>
<p>文档：<a target="_blank" rel="noopener" href="https://docs.docker.com/">Docker Documentation | Docker Documentation</a></p>
<p>仓库：<a target="_blank" rel="noopener" href="https://hub.docker.com/">Docker Hub Container Image Library | App Containerization</a></p>
<p>3） 百度相关资料：<a target="_blank" rel="noopener" href="https://baike.baidu.com/item/Docker/13344470">Docker_百度百科 (baidu.com)</a></p>
<h1 id="Docker能够用来干什么"><a href="#Docker能够用来干什么" class="headerlink" title="Docker能够用来干什么"></a>Docker能够用来干什么</h1><p>1）虚拟机  </p>
<p><img src="/.io//pic01.png" alt="虚拟机"></p>
<p>缺点：</p>
<p>占用资源（他需要一个完成的系统镜像，并且会占用宿主机的内存和硬盘）</p>
<p>操作虚拟机的时候，有很多多冗余的步骤</p>
<p>启动比较慢（也是因为虚拟机比较大）</p>
<p>2） docker -&gt; 容器技术–&gt; 不用模拟完整的系统（只需要一小部分核心，必要的）</p>
<p><img src="/.io//blog\source_posts\docker-intr-01-md\pic02.png" alt="docker"></p>
<p>容器是之际运行在宿主机的内核，容器之间，相互隔离，每个容器都有自己独立的文件系统，互不影响  </p>
<h2 id="DevOps"><a href="#DevOps" class="headerlink" title="DevOps"></a>DevOps</h2><p>容器很好的体现了敏捷开发的特点</p>
<ul>
<li><p>更快速的交付和部署</p>
</li>
<li><p>更便捷的扩容和缩容</p>
</li>
<li><p>更简单的系统运维</p>
</li>
<li><p>更高效的计算资源利用</p>
</li>
</ul>
<h1 id="容器的安装"><a href="#容器的安装" class="headerlink" title="容器的安装"></a>容器的安装</h1><h2 id="容器的组成"><a href="#容器的组成" class="headerlink" title="容器的组成"></a>容器的组成</h2><ul>
<li><p>镜像（image）</p>
</li>
<li><p>容器(container)</p>
</li>
<li><p>仓库(repository)</p>
</li>
</ul>
<h2 id="在腾讯云上安装容器"><a href="#在腾讯云上安装容器" class="headerlink" title="在腾讯云上安装容器"></a>在腾讯云上安装容器</h2><p>注意：官方有明确的教程和步骤，但是直接使用速度会比较慢，因此可以开启腾讯云加速</p>
<ul>
<li>教程：<a target="_blank" rel="noopener" href="https://docs.docker.com/engine/install/ubuntu/">Install Docker Engine on Ubuntu | Docker Documentation</a> </li>
<li>开启腾讯云加速：<a target="_blank" rel="noopener" href="https://cloud.tencent.com/document/product/1207/45596">轻量应用服务器 安装 Docker 并配置镜像加速源 - 最佳实践 - 文档中心 - 腾讯云 (tencent.com)</a></li>
</ul>
<p>安装完成后可以执行 docker run hello-world 来检查是否安装成功，效果如下  </p>
<p><img src="/.io//blog\source_posts\docker-intr-01-md\pic03.png" alt="jieguo"></p>

    </div>

    
    
    

    <footer class="post-footer">
          

<div class="post-copyright">
<ul>
  <li class="post-copyright-author">
      <strong>本文作者： </strong>zhangxin
  </li>
  <li class="post-copyright-link">
      <strong>本文链接：</strong>
      <a href="http://whu_zhangxin.gitee.io/2021/11/21/docker-intr-01-md/" title="Docker 简介">http://whu_zhangxin.gitee.io/2021/11/21/docker-intr-01-md/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>

          <div class="post-tags">
              <a href="/tags/docker/" rel="tag"># docker</a>
              <a href="/tags/%E5%AE%B9%E5%99%A8/" rel="tag"># 容器</a>
          </div>

        

    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">zhangxin</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script>

  





  





</body>
</html>
